
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>（四）ORM映射 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-prism/prism.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="../styles/website.css">
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    
    <link rel="prev" href="SQL语句.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    前言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" >
            
                <span>
            
                    
                    一、编程规约
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../编程规约/命名风格.html">
            
                <a href="../编程规约/命名风格.html">
            
                    
                    （一）命名风格
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../编程规约/常量定义.html">
            
                <a href="../编程规约/常量定义.html">
            
                    
                    （二）常量定义
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../编程规约/代码格式.html">
            
                <a href="../编程规约/代码格式.html">
            
                    
                    （三）代码格式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../编程规约/OOP规范.html">
            
                <a href="../编程规约/OOP规范.html">
            
                    
                    （四）OOP规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../编程规约/集合处理.html">
            
                <a href="../编程规约/集合处理.html">
            
                    
                    （五）集合处理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="../编程规约/并发处理.html">
            
                <a href="../编程规约/并发处理.html">
            
                    
                    （六）并发处理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="../编程规约/控制语句.html">
            
                <a href="../编程规约/控制语句.html">
            
                    
                    （七）控制语句
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.8" data-path="../编程规约/注释规约.html">
            
                <a href="../编程规约/注释规约.html">
            
                    
                    （八）注释规约
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" >
            
                <span>
            
                    
                    二、异常日志
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../异常日志/异常处理.html">
            
                <a href="../异常日志/异常处理.html">
            
                    
                    （一）异常处理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../异常日志/日志规约.html">
            
                <a href="../异常日志/日志规约.html">
            
                    
                    （二）日志规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../异常日志/其他.html">
            
                <a href="../异常日志/其他.html">
            
                    
                    （三）其他
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../单元测试.html">
            
                <a href="../单元测试.html">
            
                    
                    三、单元测试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../安全规约.html">
            
                <a href="../安全规约.html">
            
                    
                    四、安全规约
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" >
            
                <span>
            
                    
                    五、MySQL数据库
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="建表规约.html">
            
                <a href="建表规约.html">
            
                    
                    （一）建表规约
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="索引规约.html">
            
                <a href="索引规约.html">
            
                    
                    （二）索引规约
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="SQL语句.html">
            
                <a href="SQL语句.html">
            
                    
                    （三）SQL语句
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.6.4" data-path="ORM映射.html">
            
                <a href="ORM映射.html">
            
                    
                    （四）ORM映射
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" >
            
                <span>
            
                    
                    六、工程结构
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../工程结构/应用分层.html">
            
                <a href="../工程结构/应用分层.html">
            
                    
                    （一）应用分层
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../工程结构/二方库依赖.html">
            
                <a href="../工程结构/二方库依赖.html">
            
                    
                    （二）二方库依赖
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../工程结构/服务器.html">
            
                <a href="../工程结构/服务器.html">
            
                    
                    （三）服务器
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../版本历史.html">
            
                <a href="../版本历史.html">
            
                    
                    附1：版本历史 
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../本手册专有名词.html">
            
                <a href="../本手册专有名词.html">
            
                    
                    附2：本手册专有名词 
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >（四）ORM映射</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h2 id="&#x56DB;-orm&#x6620;&#x5C04;">(&#x56DB;) ORM&#x6620;&#x5C04;</h2>
<ol>
<li>&#x3010;&#x5F3A;&#x5236;&#x3011;&#x5728;&#x8868;&#x67E5;&#x8BE2;&#x4E2D;&#xFF0C;&#x4E00;&#x5F8B;&#x4E0D;&#x8981;&#x4F7F;&#x7528; * &#x4F5C;&#x4E3A;&#x67E5;&#x8BE2;&#x7684;&#x5B57;&#x6BB5;&#x5217;&#x8868;&#xFF0C;&#x9700;&#x8981;&#x54EA;&#x4E9B;&#x5B57;&#x6BB5;&#x5FC5;&#x987B;&#x660E;&#x786E;&#x5199;&#x660E;&#x3002; 
<br><span style="color:orange">&#x8BF4;&#x660E;</span>&#xFF1A;1&#xFF09;&#x589E;&#x52A0;&#x67E5;&#x8BE2;&#x5206;&#x6790;&#x5668;&#x89E3;&#x6790;&#x6210;&#x672C;&#x3002;2&#xFF09;&#x589E;&#x51CF;&#x5B57;&#x6BB5;&#x5BB9;&#x6613;&#x4E0E;resultMap&#x914D;&#x7F6E;&#x4E0D;&#x4E00;&#x81F4;&#x3002; </li>
<li>&#x3010;&#x5F3A;&#x5236;&#x3011;POJO&#x7C7B;&#x7684;&#x5E03;&#x5C14;&#x5C5E;&#x6027;&#x4E0D;&#x80FD;&#x52A0;is&#xFF0C;&#x800C;&#x6570;&#x636E;&#x5E93;&#x5B57;&#x6BB5;&#x5FC5;&#x987B;&#x52A0;is_&#xFF0C;&#x8981;&#x6C42;&#x5728;resultMap&#x4E2D;&#x8FDB;&#x884C;&#x5B57;&#x6BB5;&#x4E0E;&#x5C5E;&#x6027;&#x4E4B;&#x95F4;&#x7684;&#x6620;&#x5C04;&#x3002; 
<br><span style="color:orange">&#x8BF4;&#x660E;</span>&#xFF1A;&#x53C2;&#x89C1;&#x5B9A;&#x4E49;POJO&#x7C7B;&#x4EE5;&#x53CA;&#x6570;&#x636E;&#x5E93;&#x5B57;&#x6BB5;&#x5B9A;&#x4E49;&#x89C4;&#x5B9A;&#xFF0C;&#x5728;<resultmap>&#x4E2D;&#x589E;&#x52A0;&#x6620;&#x5C04;&#xFF0C;&#x662F;&#x5FC5;&#x987B;&#x7684;&#x3002;&#x5728;MyBatis Generator&#x751F;&#x6210;&#x7684;&#x4EE3;&#x7801;&#x4E2D;&#xFF0C;&#x9700;&#x8981;&#x8FDB;&#x884C;&#x5BF9;&#x5E94;&#x7684;&#x4FEE;&#x6539;&#x3002;</resultmap></li>
<li>&#x3010;&#x5F3A;&#x5236;&#x3011;&#x4E0D;&#x8981;&#x7528;resultClass&#x5F53;&#x8FD4;&#x56DE;&#x53C2;&#x6570;&#xFF0C;&#x5373;&#x4F7F;&#x6240;&#x6709;&#x7C7B;&#x5C5E;&#x6027;&#x540D;&#x4E0E;&#x6570;&#x636E;&#x5E93;&#x5B57;&#x6BB5;&#x4E00;&#x4E00;&#x5BF9;&#x5E94;&#xFF0C;&#x4E5F;&#x9700;&#x8981;&#x5B9A;&#x4E49;&#xFF1B;&#x53CD;&#x8FC7;&#x6765;&#xFF0C;&#x6BCF;&#x4E00;&#x4E2A;&#x8868;&#x4E5F;&#x5FC5;&#x7136;&#x6709;&#x4E00;&#x4E2A;&#x4E0E;&#x4E4B;&#x5BF9;&#x5E94;&#x3002; 
<br><span style="color:orange">&#x8BF4;&#x660E;</span>&#xFF1A;&#x914D;&#x7F6E;&#x6620;&#x5C04;&#x5173;&#x7CFB;&#xFF0C;&#x4F7F;&#x5B57;&#x6BB5;&#x4E0E;DO&#x7C7B;&#x89E3;&#x8026;&#xFF0C;&#x65B9;&#x4FBF;&#x7EF4;&#x62A4;&#x3002; </li>
<li>&#x3010;&#x5F3A;&#x5236;&#x3011;sql.xml&#x914D;&#x7F6E;&#x53C2;&#x6570;&#x4F7F;&#x7528;&#xFF1A;#{}&#xFF0C;#param# &#x4E0D;&#x8981;&#x4F7F;&#x7528;${} &#x6B64;&#x79CD;&#x65B9;&#x5F0F;&#x5BB9;&#x6613;&#x51FA;&#x73B0;SQL&#x6CE8;&#x5165;&#x3002; </li>
<li><p>&#x3010;&#x5F3A;&#x5236;&#x3011;iBATIS&#x81EA;&#x5E26;&#x7684;queryForList(String statementName,int start,int size)&#x4E0D;&#x63A8;&#x8350;&#x4F7F;&#x7528;&#x3002;
<br><span style="color:orange">&#x8BF4;&#x660E;</span>&#xFF1A;&#x5176;&#x5B9E;&#x73B0;&#x65B9;&#x5F0F;&#x662F;&#x5728;&#x6570;&#x636E;&#x5E93;&#x53D6;&#x5230;statementName&#x5BF9;&#x5E94;&#x7684;SQL&#x8BED;&#x53E5;&#x7684;&#x6240;&#x6709;&#x8BB0;&#x5F55;&#xFF0C;&#x518D;&#x901A;&#x8FC7;subList&#x53D6;start,size&#x7684;&#x5B50;&#x96C6;&#x5408;&#x3002; 
<br><span style="color:green">&#x6B63;&#x4F8B;</span>&#xFF1A;</p>
<pre class="language-"><code> Map<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>String,</span> <span class="token attr-name">Object</span><span class="token punctuation">&gt;</span></span> map = new HashMap<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>String,</span> <span class="token attr-name">Object</span><span class="token punctuation">&gt;</span></span>();    
 map.put(&quot;start&quot;, start);    
 map.put(&quot;size&quot;, size);
</code></pre></li>
<li><p>&#x3010;&#x5F3A;&#x5236;&#x3011;&#x4E0D;&#x5141;&#x8BB8;&#x76F4;&#x63A5;&#x62FF;HashMap&#x4E0E;Hashtable&#x4F5C;&#x4E3A;&#x67E5;&#x8BE2;&#x7ED3;&#x679C;&#x96C6;&#x7684;&#x8F93;&#x51FA;&#x3002; 
<br><span style="color:orange">&#x8BF4;&#x660E;</span>&#xFF1A;resultClass=&#x201D;Hashtable&#x201D;&#xFF0C;&#x4F1A;&#x7F6E;&#x5165;&#x5B57;&#x6BB5;&#x540D;&#x548C;&#x5C5E;&#x6027;&#x503C;&#xFF0C;&#x4F46;&#x662F;&#x503C;&#x7684;&#x7C7B;&#x578B;&#x4E0D;&#x53EF;&#x63A7;&#x3002;</p>
</li>
<li>&#x3010;&#x5F3A;&#x5236;&#x3011;&#x66F4;&#x65B0;&#x6570;&#x636E;&#x8868;&#x8BB0;&#x5F55;&#x65F6;&#xFF0C;&#x5FC5;&#x987B;&#x540C;&#x65F6;&#x66F4;&#x65B0;&#x8BB0;&#x5F55;&#x5BF9;&#x5E94;&#x7684;gmt_modified&#x5B57;&#x6BB5;&#x503C;&#x4E3A;&#x5F53;&#x524D;&#x65F6;&#x95F4;&#x3002;</li>
<li>&#x3010;&#x63A8;&#x8350;&#x3011;&#x4E0D;&#x8981;&#x5199;&#x4E00;&#x4E2A;&#x5927;&#x800C;&#x5168;&#x7684;&#x6570;&#x636E;&#x66F4;&#x65B0;&#x63A5;&#x53E3;&#x3002;&#x4F20;&#x5165;&#x4E3A;POJO&#x7C7B;&#xFF0C;&#x4E0D;&#x7BA1;&#x662F;&#x4E0D;&#x662F;&#x81EA;&#x5DF1;&#x7684;&#x76EE;&#x6807;&#x66F4;&#x65B0;&#x5B57;&#x6BB5;&#xFF0C;&#x90FD;&#x8FDB;&#x884C;update table set c1=value1,c2=value2,c3=value3; &#x8FD9;&#x662F;&#x4E0D;&#x5BF9;&#x7684;&#x3002;&#x6267;&#x884C;SQL&#x65F6;&#xFF0C;&#x4E0D;&#x8981;&#x66F4;&#x65B0;&#x65E0;&#x6539;&#x52A8;&#x7684;&#x5B57;&#x6BB5;&#xFF0C;&#x4E00;&#x662F;&#x6613;&#x51FA;&#x9519;&#xFF1B;&#x4E8C;&#x662F;&#x6548;&#x7387;&#x4F4E;&#xFF1B;&#x4E09;&#x662F;&#x589E;&#x52A0;binlog&#x5B58;&#x50A8;&#x3002; </li>
<li>&#x3010;&#x53C2;&#x8003;&#x3011;<code>@Transactional</code>&#x4E8B;&#x52A1;&#x4E0D;&#x8981;&#x6EE5;&#x7528;&#x3002;&#x4E8B;&#x52A1;&#x4F1A;&#x5F71;&#x54CD;&#x6570;&#x636E;&#x5E93;&#x7684;QPS&#xFF0C;&#x53E6;&#x5916;&#x4F7F;&#x7528;&#x4E8B;&#x52A1;&#x7684;&#x5730;&#x65B9;&#x9700;&#x8981;&#x8003;&#x8651;&#x5404;&#x65B9;&#x9762;&#x7684;&#x56DE;&#x6EDA;&#x65B9;&#x6848;&#xFF0C;&#x5305;&#x62EC;&#x7F13;&#x5B58;&#x56DE;&#x6EDA;&#x3001;&#x641C;&#x7D22;&#x5F15;&#x64CE;&#x56DE;&#x6EDA;&#x3001;&#x6D88;&#x606F;&#x8865;&#x507F;&#x3001;&#x7EDF;&#x8BA1;&#x4FEE;&#x6B63;&#x7B49;&#x3002; </li>
<li>&#x3010;&#x53C2;&#x8003;&#x3011;<code><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>isEqual</span><span class="token punctuation">&gt;</span></span></code>&#x4E2D;&#x7684;compareValue&#x662F;&#x4E0E;&#x5C5E;&#x6027;&#x503C;&#x5BF9;&#x6BD4;&#x7684;&#x5E38;&#x91CF;&#xFF0C;&#x4E00;&#x822C;&#x662F;&#x6570;&#x5B57;&#xFF0C;&#x8868;&#x793A;&#x76F8;&#x7B49;&#x65F6;&#x5E26;&#x4E0A;&#x6B64;&#x6761;&#x4EF6;&#xFF1B;<code><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>isNotEmpty</span><span class="token punctuation">&gt;</span></span></code>&#x8868;&#x793A;&#x4E0D;&#x4E3A;&#x7A7A;&#x4E14;&#x4E0D;&#x4E3A;null&#x65F6;&#x6267;&#x884C;&#xFF1B;<code><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>isNotNull</span><span class="token punctuation">&gt;</span></span></code>&#x8868;&#x793A;&#x4E0D;&#x4E3A;null&#x503C;&#x65F6;&#x6267;&#x884C;&#x3002;  </li>
</ol>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="SQL语句.html" class="navigation navigation-prev navigation-unique" aria-label="Previous page: （三）SQL语句">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"（四）ORM映射","level":"1.6.4","depth":2,"next":{"title":"六、工程结构","level":"1.7","depth":1,"ref":"","articles":[{"title":"（一）应用分层","level":"1.7.1","depth":2,"path":"工程结构/应用分层.md","ref":"工程结构/应用分层.md","articles":[]},{"title":"（二）二方库依赖","level":"1.7.2","depth":2,"path":"工程结构/二方库依赖.md","ref":"工程结构/二方库依赖.md","articles":[]},{"title":"（三）服务器","level":"1.7.3","depth":2,"path":"工程结构/服务器.md","ref":"工程结构/服务器.md","articles":[]}]},"previous":{"title":"（三）SQL语句","level":"1.6.3","depth":2,"path":"MySQL数据库/SQL语句.md","ref":"MySQL数据库/SQL语句.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["book-summary-scroll-position-saver","github","prism","-sharing","-highlight"],"pluginsConfig":{"github":{"url":"https://github.com/alibaba/p3c"},"book-summary-scroll-position-saver":{},"prism":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css"}},"file":{"path":"MySQL数据库/ORM映射.md","mtime":"2018-01-13T07:52:52.580Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-01-15T14:41:43.583Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-book-summary-scroll-position-saver/book-summary-scroll-position-saver.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

